package com.xinyou.u8c.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinyou.u8c.entity.ImportLog;
import com.xinyou.u8c.entity.VouchPagination;
import com.xinyou.u8c.result.JsonResult;
import com.xinyou.u8c.service.IImportLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * ??? 前端控制器
 * </p>
 *
 * @author chq
 * @since 2023-09-18
 */
@RestController
@RequestMapping("/u8c/import-log")
public class ImportLogController {

    @Autowired
    private IImportLogService iImportLogService;

    @PostMapping("/getList")
    public JsonResult getList(VouchPagination pagination) {
        LambdaQueryWrapper<ImportLog> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.orderByDesc(ImportLog::getId);
        Page<ImportLog> pageWhere = new Page<>(pagination.getPage().longValue(), pagination.getPageSize().longValue());
        IPage<ImportLog> pageData = iImportLogService.page(pageWhere, queryWrapper);
        return new JsonResult(true, pageData);
    }

}
